<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="liguangdong">
<title>客户分级规则审核</title>
<script language="javascript" src="../script/common.js"
	type="text/javascript"></script>

<script language="javascript" type="text/javascript">

       var org = Common.cOrg();		  //当前单位
       var qt = {};				     //数据表格对象
	   var qt1 = {};
	   var qt2 = {};
	   var qt11={};
       var operatorName=Common.cOperator().name;
       var templetList=[{code:"2",text:"等待审核"},{code:"3",text:"审核通过"},{code:"4",text:"审核未通过"}]
       function load(){
	      
		Eui.showNavigation(); 	
	    
	  　　Common.initDict(search.status,templetList);
	 	      //数据字典中的change_state中1,初始化2,等待审核3,审核通过 4,未审未通过
	 	Common.initDict(crelistform1.check_state, "check_state", "请选择");   
	 	      //数据字典中的check_state中的1代表通过 2代表未通过
	 	setPages(["listview","listview2","listview3"]);
	    createTable11();
		showData11();
		}
		function showData(){
          createTable();
          }
    
		//生成表格，创建QueryTable对象   
		function createTable(){
			var columns =[];
		   //columns[1]={render:function(v){return v.format();}}
		   //columns[2]={render:function(v){return v.format();}}
			// columns[8]={title:"操作",width:"12%",align:"center",render:chakan,order:false}
			 columns[10]={title:"操作",width:"12%",align:"center",render:shenhe,order:false}
			 
			
			qt = new QueryTable("loy_gradeSchemeShenHe","search","datalist",columns);
			qt.showTable();	
			
			 
		}
		function showData11()
		{
		   $('dlist').style.display = "none";
		   qt11.showTable();
		}
		function createTable11()
		{
		  var columns =[];
		 // columns[8]={title:"操作",width:"12%",align:"center",render:chakan,order:false}
	      columns[10]={title:"操作",width:"12%",align:"center",render:shenhe,order:false}
		  qt11 = new QueryTable("loy_gradeSchemePre","search","datalist",columns);
		 
			 
		}
		 function createTable1(){
			var columns=[];
			 qt1 = new QueryTable("loy_gradeRule","crelistform","datalist111",columns,{showData:"true",
					buttons:[
						
						{value:"返 回",actions:Cancel}
					]
				});
			qt1.showTable();
		}
    
      function createTable2(){
			var columns=[];
			 qt2 = new QueryTable("loy_gradeRule","crelistform1111","datalist1111",columns);
			 qt2.showTable();
		}
	function Len(str)
    {
      var i,sum;
      sum=0;
      for(i=0;i<str.length;i++)
      {
         if ((str.charCodeAt(i)>=0) && (str.charCodeAt(i)<=255))
             sum=sum+1;
          else
             sum=sum+2;
      }
      return sum;
    
    }
	function save()
		
		 {
		   var a=$('crelistform1').opinion111.value;
		   var state=$('crelistform1').check_state.value;
		   var a1=new String(a);
		   if(state==0)
		      {
		            showQuestion("请选择审核结果!")
		      }
		  else if(Len(a1)>40)
		       {
　　                showQuestion('输入框中输入的长度不能超过40个字符!');
　　             }
		    else{
		   
		    	     DWR.call('gradeService.shenHeGradeScheme',$('crelistform1111').orderid.value,$('crelistform1').check_state.value,a1,function(v){
		    	              showQuestion("审核成功!");
				              createTable11();
		                      showData11();
		 		              switchPage('listview');
		    	           });	
		    	}
		}
       function Cancel()
		{
			 createTable11();
		     showData11();
			 switchPage('listview');
		}
     
      function see(id,startDate,endDate,flag,checker,checkerDate,comments,opinions)
      
      {
                    
              $("crelistform").orderid.value=id;
			  switchPage("listview2");
			 // $("actno").innerHTML=code;
			  $("ShenHeDate").innerHTML=checkerDate;
			  $("gradeSchemeFlag").innerHTML=flag;
			  $("sendoper").innerHTML=checker;
		      $("ShenHeComments").innerHTML=comments;
		      if(opinions!="null")
		      {
		       $("opinion222").innerHTML=opinions.toString();
		      }
		      else{
		       $("opinion222").innerHTML="";
		      }
		      createTable1();
      }
      
      function shenhe(v,r)
      
      {
          if(r[3]=="等待审核")
          {
               return "<a href=# onclick=\"shenhe111('"+r[0]+"','"+r[1]+"','"+r[2]+"','"+r[3]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"','"+r[7]+"');return false;\">审核</a>"
          }
          else
          {
              return "<a href=# onclick=\"see('"+r[0]+"','"+r[1]+"','"+r[2]+"','"+r[3]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"','"+r[7]+"');return false;\">查看审核</a>"
          }
         
      }
      function shenhe111(id,startDate,endDate,flag,checker,checkerDate)
      
        { 
                 $('listview').style.display = "none";
                 $('dlist').style.display = "";
                 $("crelistform1111").orderid.value=id;
			    // $("actno1111").innerHTML=code;
			     $("gradeSchemeFlag1111").innerHTML=flag;
                 createTable2();   
                 switchPage("listview3");
        }
</script>
</head>


<body onload="load()">
<!--页面导航-->
<div class="nav">
<div id="nav">&nbsp;</div>
</div>
<div id="content">
<div id="listview">
<div class="searchForm">
<form name="search"><input type=hidden id="orgn" name="orgn">
<table cellSpacing=0 cellPadding=4 width="100%" border=0>
	<tr>
		<td><label>审核状态</label> <select name="status"><option>等待审核</option></select></td>
		<td><button type="button" onclick="showData()">查 询</button></td>
	</tr>
</table>
</form>
</div>
<div id=datalist></div>
</div>
</div>

<!--明细(新增)静态页面部分-->
<div id=listview2 style='display: none;' align=center>
<div class=form>
<form id="crelistform" name="crelistform" action=""><input
	type=hidden id="orderid" name="orderid">

<div class="formTitle">分级计划信息</div>
<table cellSpacing=0 cellPadding=4 width="100%" border=0
	class="col3 label6">
	<tr>
		
		<td><label>计划状态</label> <span id="gradeSchemeFlag"></span></td>
		<td><label>审核人&nbsp;&nbsp;</label> <span id="sendoper"></span></td>
	</tr>
	<tr>
		<td><label>审核日期&nbsp;&nbsp;&nbsp;&nbsp;</label> <span id="ShenHeDate"></span></td>
		<td><label>审核结果</label> <span id="ShenHeComments"></span></td>
	</tr>
	<tr>
	    <td><label align="center">审核意见</label></td>
		
	</tr>
<tr>
    <td><textarea name="opinion222" cols="50" rows="3" id="opinion222" readonly></textarea></td>
</tr>
</table>
</form>
</div>
<div id="datalist111"></div>
</div>


<div id="listview3" style='display: none;' align=center>
<form id="crelistform1111" name="crelistform1111" action=""><input type=hidden id="orderid" name="orderid">
<div class=form>
<div class="formTitle">分级计划审核</div>
<table cellSpacing=0 cellPadding=4 width="100%" border=0
	class="col3 label3">
	<!-- 	<td><label>分级计划编号</label> <span id="actno1111"></span></td>   -->
	<tr>
	
		<td><label>计划状态:</label> <span id="gradeSchemeFlag1111"></span></td>
	</tr>
</table>
</div>
</form>
<div id="datalist1111"></div>
</div>


<div id="dlist">
<form id='crelistform1' name='crelistform1' method='POST'
	enctype='multipart/form-data' action='/upload/pic/'>
<div class=form  name='pp' id='pp' align=center>
<table cellSpacing=0 cellPadding=5 width="100%" border=0
	class="col3 label6">
<tr>
	<td><label>审核结果</label>
	<select name="check_state" onblur="checkV(this,'',true)"></select><font color="red">&nbsp;*</font>
	
	</td>
</tr>	
<tr>
     <td><label align="center">审核意见</label></td>
</tr>
<tr>
<td><textarea name="opinion111" cols="80" rows="4" id="opinion111"> </textarea></td>
</tr>
<tr>
<td>
<button type="button" onclick="save()">确&nbsp;&nbsp;&nbsp;&nbsp;认</button>
</td>
</tr>
</table>
</div>
</form>
<button type="button" onclick="Cancel()">返回</button>
</div>
</body>
</head>